home *** CD-ROM | disk | FTP | other *** search
- /* SOS */
- /***************************************************************************
-
- Doc2Hlp
- © LF soft 1992
-
- Doc2Hlp can use french if you set the Lang Env-variable to "français".
-
- Doc2Hlp convert CSH man files to LFman file format. It can work w/
- version 4.02 of CSH or plus if Shell.doc keep the same format.
- (tested w/ 5.19 CSH docs file).
-
- Doc2Hlp is a FreeWare product of L.FAILLIE. All rights reserved.
- You can't use this tools, nor LFman, on a Comercial product. You must
- also get the licence of LFman if you think it's usefull. Read
- the LFman doc ( LFman.aide or LFman.man ) for more informations .
-
-
- L.FAILLIE
- " Les Vuardes "
- 74930 Reignier
- FRANCE
-
- Doc2Hlp work fine but I think you need to delete some extra ##.
- ***************************************************************************/
-
-
- #include <LF.h>
- #include <string.h>
- #include <stdlib.h>
-
- volatile UBYTE lang=0; /* English by default */
- register UBYTE fl=0;
-
- volatile char *var; /* Ptr on var */
- char l[256];
-
- volatile const char *cof_err[]={"Can't open file","Erreur d'ouverture"};
-
- void error(char *msg){
- printf("\033[33m%s\n\033[0m",msg);
- }
-
- void main(int ac, char **av){
-
- FILE *src,*dst;
-
- if(var=getenv("Lang")){
- if(!stricmp(var,"Français"))
- lang=1;
- }
-
- if(ac!=3){
- error(" Doc2Hlp");
- puts(" © LF 1992\n");
- puts(" \33[1mSyntaxe :\33[0m\n Doc2Hlp src dst");
- switch(lang){
- case 1: /* français */
- puts("Convertie le fichier doc de CSH en fichier LFman");
- break;
- default :
- puts("Make a LFman file from the CSH doc file");
- }
- exit(0);
- }
-
- if(!(src=fopen(av[1],"r"))|| !(dst=fopen(av[2],"w"))){
- error(cof_err[lang]);
- exit(0);
- }
-
- until(feof(src)){
- LFgets(src,l,255);
- if(feof(src))
- break;
- if(!strncmp(l," ",4)){
- fl=0;
- fprintf(dst,"##%s\n",&(l[4]));
- } else if(strlen(l)==0){
- if(fl){
- fprintf(dst,"##\n");
- fl=0;
- } else {
- fl=1;
- fprintf(dst,"\n");
- }
- } else {
- fl=0;
- fprintf(dst,"%s\n",l);
- }
- }
- fclose(src);
- fclose(dst);
- exit(0);
- }
-